#coding=utf8

from base import TBase

class Cats(TBase):
    typename = 'cats'
    method = 'cats.'
    fields=''

    def itemcats(self, fields='', parent_cid=0):
        self.method = 'itemcats.get'
        self.setParams(parent_cid=parent_cid)
        self.session = ''
        if fields:
            self.fields=fields
        else:
            self.fields = 'cid,parent_cid,name,is_parent,status,sort_order'
        return self.do()

    #def list(self, sessionkey, nick, fields=''):
    #    self.method = 'taobao.itempropvalues.get'
    #    self.session = sessionkey
    #    self.setParams(nick=nick)
    #    if fields:
    #        self.fields=fields
    #    else:
    #        self.fields = 'cid,pid,prop_name,vid,name,name_alias,is_parent,status,sort_order'
    #    r = self.do() 
    #    return r['seller_cats']


if __name__ == '__main__':
    a = Cats()
    import json
    json.dump(a.itemcats(parent_cid=30), open('cats2.json', 'w'))

